home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_10 / jagger / printf3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-25  |  692 b   |  32 lines

  1. /* Listing 12, printf.c, version 3 */
  2. #include <stdarg.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. #include "check.h"    /* Listing 5  */
  7. #include "printf.h"   /* Listing 10 */
  8. #include "dbmeta.hi"  /* Listing 11 */
  9.  
  10. #undef printf    
  11.  
  12. DB_DEFN(
  13. int, printf, (const char format[], ... ))
  14.     {
  15.     va_list ap;
  16.     int returnValue;
  17.  
  18.     UNDEFINED_IF(format == NULL);
  19.     WARNING_IF(strchr(format, '%') == 
  20.                NULL);
  21.     WARNING_IF(strstr(format, "%ul") != 
  22.                NULL);
  23.     WARNING_IF(strstr(format, "%p") != 
  24.                NULL);
  25.     va_start(ap, format);
  26.     returnValue = vprintf(format, ap);
  27.     va_end(ap);
  28.     WARNING_IF(returnValue < 0);
  29.     return returnValue;
  30.     }
  31.  
  32.